<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page isELIgnored="false" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <base href="<%=basePath%>">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>收藏中心</title>
    <link rel="stylesheet" href="render/css/frontend/common/base.css" type="text/css"/>
    <link rel="stylesheet" href="render/css/frontend/common/shop_common.css" type="text/css"/>
    <link rel="stylesheet" href="render/css/frontend/shop_header.css" type="text/css"/>
    <link rel="stylesheet" href="render/css/frontend/shop_manager.css" type="text/css"/>
    <link rel="stylesheet" href="render/css/frontend/shop_list.css" type="text/css"/>

    <script type="text/javascript" src="render/js/jquery.min.js"></script>

    <style type="text/css">
        dd.shop_name {
            margin: 8px;
            display: inline-block;
        }
        dd.shop_collection {
            display: inline-block;
            /* margin: 0 0 0 58px; */
            font-size: 17px;
        }
        img.shop_image{
            width: 103px !important;
            height: 105px !important;
        }
        .shop_bd_list_content{
            min-height: 330px;
        }

        #tuijian_content_1_empty {
            /* margin: 80px 0; */
            margin: 72px 0px 0px 0px !important;
            text-align: center;
            font-size: 33px;
            width: 100% !important;
            color: red;
        }
    </style>
</head>
<body>
<!-- Header Start -->
<jsp:include page="common/head.jsp"></jsp:include>

<!-- TopHeader Center -->
<jsp:include page="common/topheader_center.jsp"></jsp:include>
<!-- TopHeader Center End -->

<!-- Header Menu -->
<jsp:include page="common/header_menu.jsp"></jsp:include>
<!-- Header Menu End -->

<div class="shop_hd_breadcrumb">
    <strong>当前位置：</strong>
    <span>
        <a href="/">首页</a>&nbsp;›&nbsp;
        <a href="/render/myhome">个人中心</a>&nbsp;›&nbsp;
        <a href="/render/favorite">收藏中心</a>
    </span>
</div>
<div class="clear"></div>
<!-- 面包屑 End -->
<!-- Header End -->

<!-- 我的个人中心 -->
<div class="shop_member_bd clearfix">
    <!-- 左边导航 -->
    <jsp:include page="common/myshop_left.jsp"></jsp:include>
    <!-- 左边导航 End -->

    <!-- 右边购物列表 -->
    <div class="shop_member_bd_right clearfix">
        <div class="shop_meber_bd_good_lists clearfix">
            <div class="title">
                <h3>我的收藏</h3>
            </div>

            <!-- 商品列表 -->
            <div class="shop_bd_list_content clearfix">
                <ul>
                    <c:if test="${!empty pb.beanList}">
                        <c:forEach items="${pb.beanList}" var="collect">
                            <li id="${collect.id}">
                                <dl>
                                    <dt>
                                        <a href="/render/shop/queryShopByShopId?shop_id=${collect.shop_id}">
                                            <img class="shop_image" src="${collect.shop_image}"/>
                                        </a>
                                    </dt>
                                    <dd class="shop_name">
                                        <a href="/render/shop/queryShopByShopId?shop_id=${collect.shop_id}">${collect.shop_name}</a>
                                    </dd>
                                    <dd class="shop_collection">
                                        <a href="javascript:void(0);" onclick="deleteCollect('/render/collection/delete?collect_id=${collect.id}&user_id=${collect.user_id}','${collect.id}')" class="goods_jiage"><span>取消</span></a>
                                    </dd>
                                </dl>
                            </li>
                        </c:forEach>
                    </c:if>
                    <c:if test="${empty pb.beanList}">
                        <li id="tuijian_content_1_empty">暂无收藏！</li>
                    </c:if>
                </ul>
            </div>
            <div class="clear"></div>
            <div class="pagination">
                <c:if test="${!empty pb.beanList}">
                    <ul>
                        <li>
                            <span><a href="/render/collection/favorite?id=${cid}&pc=1">首页</a></span>
                        </li>
                            <%--上一页 --%>
                        <li>
                            <c:choose>
                                <c:when test="${pb.pc eq 1 }">
                                    <span>上一页</span>
                                </c:when>
                                <c:otherwise>
                                    <span><a href="/render/collection/favorite?id=${cid}&pc=${pb.pc-1}">上一页</a></span>
                                </c:otherwise>
                            </c:choose>
                        </li>

                        <c:choose>
                            <c:when test="${pb.tp <= 6 }">
                                <c:set var="begin" value="1"/>
                                <c:set var="end" value="${pb.tp }"/>
                            </c:when>
                            <c:otherwise>
                                <c:set var="begin" value="${pb.pc-2 }"/>
                                <c:set var="end" value="${pb.pc + 3}"/>
                                <c:if test="${begin < 1 }">
                                    <c:set var="begin" value="1"/>
                                    <c:set var="end" value="6"/>
                                </c:if>
                                <c:if test="${end > pb.tp }">
                                    <c:set var="begin" value="${pb.tp-5 }"/>
                                    <c:set var="end" value="${pb.tp }"/>
                                </c:if>
                            </c:otherwise>
                        </c:choose>

                        <c:forEach begin="${begin }" end="${end }" var="i">
                            <c:choose>
                                <c:when test="${i eq pb.pc }">
                                    <li><span class="spanBtnSelect">${i}</span></li>
                                </c:when>
                                <c:otherwise>
                                    <li><span><a href="/render/collection/favorite?id=${cid}&pc=${i}" class="aBtn">${i}</a></span></li>
                                </c:otherwise>
                            </c:choose>
                        </c:forEach>

                        <c:if test="${end < pb.tp }">
                            <span class="spanApostrophe">...</span>
                        </c:if>

                            <%--下一页 --%>
                        <li>
                            <c:choose>
                                <c:when test="${pb.pc eq pb.tp }">
                                    <span>下一页</span>
                                </c:when>
                                <c:otherwise>
                                    <span><a href="/render/collection/favorite?id=${cid}&pc=${pb.pc+1}">下一页</a></span>
                                </c:otherwise>
                            </c:choose>
                        </li>
                        <li>
                            <c:choose>
                                <c:when test="${pb.pc eq pb.tp }">
                                    <span>末页</span>
                                </c:when>
                                <c:otherwise>
                                    <span><a href="/render/collection/favorite?id=${cid}&pc=${pb.tp}">末页</a></span>
                                </c:otherwise>
                            </c:choose>
                        </li>
                    </ul>
                </c:if>
            </div>
        </div>
    </div>
    <!-- 右边购物列表 End -->
</div>
<!-- 我的个人中心 End -->

<!-- Footer - wll -->

<jsp:include page="common/footer.jsp"></jsp:include>
<!-- Footer End -->
<script type="text/javascript">
    function deleteCollect(url,id) {
        $.ajax({
            type: 'post',
            url: url,
            success: function (data) {
                if (data.success){
                    $("#"+id).remove();
                    HFalert({title:data.message,type: 'success', confirmButtonText: '确定'});
                } else {
                    HFalert({title:data.message,type: 'warning', confirmButtonText: '确定'});
                }
            }
        });
    }
</script>
</body>
</html>